package com.xiaodong.controller;

import org.springframework.aop.framework.AopContext;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hzd
 * @date 2023/12/25 17:49
 */
@RestController
public class TestController {

  @RequestMapping("testCacheAble")
  public String test(){
    TestController proxy = (TestController)AopContext.currentProxy();
    return proxy.testCache(1);
  }


  @Cacheable("testCache")
  public String testCache(Integer id){
    return "123";
  }
}
